import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '测点编码',
    align: "center",
    dataIndex: 'stationCode'
  },
  {
    title: '水泵名称 ',
    align: "center",
    dataIndex: 'pumpName'
  },
  {
    title: '开始时间',
    align: "center",
    dataIndex: 'startTime'
  },
  {
    title: '结束时间',
    align: "center",
    dataIndex: 'endTime'
  },
  {
    title: '开关泵标识',
    align: "center",
    dataIndex: 'switchPump'
  },
  {
    title: '数据时间',
    align: "center",
    dataIndex: 'dataTime'
  },
  {
    title: '煤矿编码',
    align: "center",
    dataIndex: 'stationMine'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '测点编码',
    field: 'stationCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入测点编码!'},
             ];
    },
  },
  {
    label: '水泵名称 ',
    field: 'pumpName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入水泵名称 !'},
             ];
    },
  },
  {
    label: '开始时间',
    field: 'startTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入开始时间!'},
             ];
    },
  },
  {
    label: '结束时间',
    field: 'endTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入结束时间!'},
             ];
    },
  },
  {
    label: '开关泵标识',
    field: 'switchPump',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入开关泵标识!'},
             ];
    },
  },
  {
    label: '数据时间',
    field: 'dataTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入数据时间!'},
             ];
    },
  },
  {
    label: '煤矿编码',
    field: 'stationMine',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  stationCode: {title: '测点编码',order: 0,view: 'text', type: 'string',},
  pumpName: {title: '水泵名称 ',order: 1,view: 'text', type: 'string',},
  startTime: {title: '开始时间',order: 2,view: 'datetime', type: 'string',},
  endTime: {title: '结束时间',order: 3,view: 'datetime', type: 'string',},
  switchPump: {title: '开关泵标识',order: 4,view: 'number', type: 'number',},
  dataTime: {title: '数据时间',order: 5,view: 'datetime', type: 'string',},
  stationMine: {title: '煤矿编码',order: 6,view: 'text', type: 'string',},
};
